<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
    <head>
        <link href="<c:url value='/resources/css/layout.css'/>" rel="stylesheet" type="text/css"/>
        <title><fmt:message key="label.eventos"/></title>
    </head>
    <body>
        <div class="titleDiv"><fmt:message key="application.title"/></div>
        <br/>
        <br/>
        <h1><fmt:message key="label.lista.eventos"/></h1>
        <table class="tabelaEventos">
            <tr>
                <th><fmt:message key="label.evento.nome"/></th>
                <th><fmt:message key="label.evento.descricao"/></th>
                <th><fmt:message key="label.evento.local"/></th>
                <th><fmt:message key="label.evento.cidade"/></th>
                <th><fmt:message key="label.evento.telefone"/></th>
                <th><fmt:message key="label.evento.data"/></th>
                <th>&nbsp;</th>
            </tr>
            <c:forEach var="evento" items="${eventos}" varStatus="status">
                <tr class="${status.index%2==0?'even':'odd'}">
                    <td class="nowrap"><c:out value="${evento.nome}"/></td>
                    <td class="nowrap"><c:out value="${evento.descricao}"/></td>
                    <td class="nowrap"><c:out value="${evento.local}"/></td>
                    <td class="nowrap"><c:out value="${evento.cidade}"/></td>
                    <td class="nowrap"><c:out value="${evento.telContato}" /></td>
                    <td class="nowrap"><fmt:formatDate value="${evento.dataEvento}" pattern="dd/MM/yyyy" /></td>
                    <td class="nowrap">
                        <c:url var="url" scope="page" value="/adicionarEditarEvento.do">
                            <c:param name="idEvento" value="${evento.idEvento}"/>
                            <c:param name="idUsuario" value="${usuario}"/>                            
                            <c:param name="dispatch" value="setaInsercaoEdicaoEvento"/>
                        </c:url>
                        <a href="${url}">Editar</a>
                        &nbsp;&nbsp;&nbsp;
                        <c:url var="url" scope="page" value="/eventoProcess.do">
                            <c:param name="idEvento" value="${evento.idEvento}"/>
                            <c:param name="dispatch" value="remover"/>
                            <c:param name="idUsuario" value="${usuario}"/>
                        </c:url>
                        <a href="${url}">Remover</a>
                    </td>
                </tr>
            </c:forEach>
        </table>
        <c:url var="urlAdd" scope="page" value="/adicionarEditarEvento.do">
            <c:param name="dispatch" value="setaInsercaoEdicaoEvento"/>
            <c:param name="idUsuario" value="${usuario}"/>
        </c:url>
        <br/>
        <input type="submit" value="<fmt:message key="button.label.evento.adicionar" />" class="butStnd" onclick="document.location.href='${urlAdd}'" />
        &nbsp;&nbsp;&nbsp;
        <c:url var="url" scope="page" value="/usuarioProcess.do">
            <c:param name="dispatch" value="getUsuarios" />
        </c:url>
        <input type="button" value="<fmt:message key="button.label.voltar" />"  class="butStnd" onclick="document.location.href='${url}'" />
    </body>
</html>